/*
 * commons is a based project implemented
 * Copyright (C) 2024 Jasmine
 */
package com.easy.web.config;

import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

// @Configuration
// @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET)
public class ProjectWebConfiguration implements WebMvcConfigurer {

    /* @Bean
    @ConditionalOnMissingBean
    public FilterRegistrationBean<CorsFilter> corsFilter() {
        FilterRegistrationBean<CorsFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(new CorsFilter());
        registrationBean.addUrlPatterns("/*");
        return registrationBean;
    }*/
    /* @Override
     public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
       MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();
       ObjectMapper objectMapper = jackson2HttpMessageConverter.getObjectMapper();
       objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
       objectMapper.setTimeZone(TimeZone.getTimeZone("GMT+8"));
       objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
    
       // 后台Long值传递给前端精度丢失问题（JS最大精度整数是Math.pow(2,53)）
       SimpleModule simpleModule = new SimpleModule();
       simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
       // simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
       // simpleModule.addSerializer(BigInteger.class, ToStringSerializer.instance);
       objectMapper.registerModule(simpleModule);
    
       jackson2HttpMessageConverter.setObjectMapper(objectMapper);
       converters.add(0, jackson2HttpMessageConverter);
     }*/

}
